package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 柱状图，返回JobOption类型对象
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        JobOption jobOption =  reportService.getEmpJobData();
        return  Result.success(jobOption);
    }

    /**
     * 员工性别统计
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        List<Map> listMap =  reportService.getEmpGenderData();
        return Result.success(listMap);
    }

    /**
     * 学生学位统计
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegree(){
        List<Map> listStudentDegree =  reportService.getstudentDegreeData();
        return Result.success(listStudentDegree);
    }


    @GetMapping("/studentCountData")
    public Result getStudentCount(){
        StudentOption studentOption =  reportService.getStudentCount();
        return Result.success(studentOption);
    }
}
